﻿
using System.Collections.Generic;
using LitJson;

namespace FrameWorkSong
{
    public static class JsonUtil
    {
        static Dictionary<string, object> Data = new Dictionary<string, object>();
        static List<object> DataArray = new List<object>();
        static List<Dictionary<string, object>> Datas = new List<Dictionary<string, object>>();
        public static void AddData(string key, object value)
        {
            Data.Add(key, value);
        }
        public static void AddDataArray(object value)
        {
            DataArray.Add(value);
        }
        public static string GetJsonString()
        {
            string Json = JsonMapper.ToJson(Data);
            Data.Clear();
            return Json;

        }
        public static void AddDatas()
        {
            Datas.Add(Data);
            Data = new Dictionary<string, object>();
        }
        public static string GetJsonStrings()
        {
            string Json = JsonMapper.ToJson(Datas);
            Datas.Clear();
            return Json;
        }
        public static string GetDataArray()
        {
            string Json = JsonMapper.ToJson(DataArray);
            DataArray.Clear();
            return Json;
        }
    }

}

